package com.chatcompetition.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.chatcompetition.domain.dto.FeedbackDTO;
import com.chatcompetition.domain.entity.Employee;
import com.chatcompetition.domain.entity.Feedback;
import com.chatcompetition.mapper.EmployeeMapper;
import com.chatcompetition.mapper.FeedbackMapper;
import com.chatcompetition.service.EmployeeService;
import com.chatcompetition.service.FeedbackService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
@Slf4j
public class FeedbackServiceImpl extends ServiceImpl<FeedbackMapper, Feedback> implements FeedbackService {



    @Autowired
    private  FeedbackMapper feedbackMapper;
    @Override
    public void addFeedback(FeedbackDTO feedbackDTO) {
        log.info("反馈内容：{}", feedbackDTO);

        Feedback feedback = new Feedback();
        feedback.setType(feedbackDTO.getFeedbackType());
        feedback.setContent(feedbackDTO.getFeedbackContent());
        if(feedbackDTO.getFileList().size() > 0){
            feedback.setPhotoUrl(feedbackDTO.getFileList().get(0).getUrl());
        }else{
            feedback.setPhotoUrl("null");
        }


        log.info("反馈:{}", feedback.toString() );
        feedbackMapper.addFeedback(feedback);



    }
}
